package chinatelecom.feilong.framework.web.license.entity;

import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

@Entity
@Table(name = "tbl_license_info")
public class License implements Serializable {
    private int id;           // 主键
    private LicenseTemplate licenseTemplate;   // 默认为1
    private LicenseMain licenseMain;  // license的名称
    private Date issuedDate;// license的创建时间
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date notBefore;
    private Date notAfter;
    private Integer validity;    // license的有效期
    private String info;      // license的说明信息
    private String ip;        // 用户的IP
    private String disk;      // 用户的disk
    private Integer machine;     // licene主机管理数量
    private String mac;       // 用户的mac
    private String motherboard;// 用户的主板序列号
    private String system;      // 用户的系统序列号
    private String cpu;         // 用户的CPU序列号
    private Integer renewTimes;
    private String content;   // 由上述信息组装而成的内容
    private String path;      // license的存储路径

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id", nullable = false)
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Basic
    @ManyToOne
    @JoinColumn(name = "type_id",referencedColumnName = "id", nullable = false)
    public LicenseTemplate getLicenseTemplate() {
        return licenseTemplate;
    }

    public void setLicenseTemplate(LicenseTemplate licenseTemplate) {
        this.licenseTemplate = licenseTemplate;
    }

    @Basic
    @ManyToOne
    @JoinColumn(name = "subject_id", referencedColumnName = "id", nullable = false)
    public LicenseMain getLicenseMain() {
        return licenseMain;
    }

    public void setLicenseMain(LicenseMain licenseMain) {
        this.licenseMain = licenseMain;
    }

    @Basic
    @Column(name = "issued_date", nullable = true)
    public Date getIssuedDate() {
        return issuedDate;
    }

    public void setIssuedDate(Date issuedDate) {
        this.issuedDate = issuedDate;
    }
    @Basic
    @Column(name = "not_before", nullable = true)
    public Date getNotBefore() {
        return notBefore;
    }

    public void setNotBefore(Date notBefore) {
        this.notBefore = notBefore;
    }
    @Basic
    @Column(name = "not_after", nullable = true)
    public Date getNotAfter() {
        return notAfter;
    }

    public void setNotAfter(Date notAfter) {
        this.notAfter = notAfter;
    }
    @Basic
    @Column(name = "info", nullable = true)
    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }
    @Basic
    @Column(name = "ip", nullable = true)
    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }
    @Basic
    @Column(name = "disk", nullable = true)
    public String getDisk() {
        return disk;
    }

    public void setDisk(String disk) {
        this.disk = disk;
    }
    @Basic
    @Column(name = "mac", nullable = true)
    public String getMac() {
        return mac;
    }

    public void setMac(String mac) {
        this.mac = mac;
    }
    @Basic
    @Column(name = "renew_times", nullable = false)
    public Integer getRenewTimes() {
        return renewTimes;
    }

    public void setRenewTimes(Integer renewTimes) {
        this.renewTimes = renewTimes;
    }
    @Basic
    @Column(name = "content", nullable = true)
    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }
    @Basic
    @Column(name = "path", nullable = true)
    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }
    @Basic
    @Column(name = "validity", nullable = true)
    public Integer getValidity() {
        return validity;
    }

    public void setValidity(Integer validity) {
        this.validity = validity;
    }
    @Basic
    @Column(name = "machine", nullable = true)
    public Integer getMachine() {
        return machine;
    }

    public void setMachine(Integer machine) {
        this.machine = machine;
    }
    @Column(name = "motherboard", nullable = true)
    public String getMotherboard() {
        return motherboard;
    }

    public void setMotherboard(String motherboard) {
        this.motherboard = motherboard;
    }
    @Column(name = "system", nullable = true)
    public String getSystem() {
        return system;
    }

    public void setSystem(String system) {
        this.system = system;
    }
    @Column(name = "cpu", nullable = true)
    public String getCpu() {
        return cpu;
    }

    public void setCpu(String cpu) {
        this.cpu = cpu;
    }

    /*    @OneToOne
     @JoinColumn(name="type_id", referencedColumnName = "id", table = "tbl_license_template")
     public LicenseTemplate getTemplate() {
          return template;
     }

     public void setTemplate(LicenseTemplate template) {
          this.template = template;
     }*/
}
